package com.zl.zlbaseproject.ui.product.fragment;


import android.support.annotation.NonNull;
import android.view.View;

import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.zl.zlbaseproject.R;
import com.zl.zlbaseproject.base.fragment.DefaultMvpFragment;
import com.zl.zlbaseproject.presenter.product.ProductFragmentComtract;
import com.zl.zlbaseproject.presenter.product.ProductFragmentPresenter;

/**
 * Created by 郑磊 on 2018/5/27.
 */

public class ProductFragment extends DefaultMvpFragment<ProductFragmentComtract.Presenter> implements ProductFragmentComtract.View {





    @Override
    protected void initView() {
        super.initView();
        initToolbar(mToolbar,mIvBack,false);
        mTvTitle.setText("项目");
    }

    @Override
    protected int getContentRes() {
        return R.layout.fragment_product;
    }


    @Override
    protected ProductFragmentComtract.Presenter initPresenter() {
        return new ProductFragmentPresenter(this, getContext());
    }


    @Override
    public void onLoadFailed() {
        mLlError.setVisibility(View.VISIBLE);
        mRefreshLayout.finishRefresh();

    }

    @Override
    public void onLoadSuccess() {
        mRefreshLayout.finishRefresh();
        mLlError.setVisibility(View.GONE);
    }

    @Override
    public void onRefresh(@NonNull RefreshLayout refreshLayout) {
        mPresenter.loadData();
    }


}
